/**
 * 
 */
package com.unsanctioned.radioagregator.fragments;

import com.unsanctioned.radioagregator.http.utils.HttpRequestSupport;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * @author wizard
 *
 */
public class AgendaFragment extends ListFragment {
	
	// This interface must be implemented by MainActivity
	public interface OnAgendaSelectedListener {
		public void onAgendaSelected();
	}
	
	private OnAgendaSelectedListener mOnAgendaSelectedListener;
	private boolean notFoundException;
	private boolean connectionTimedOut;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		
		if (HttpRequestSupport.isConnectionAvailable(getActivity())) {
			// Try to retrieve online data using HttpRequest.

		} else {
			// Load offline data stored in database if there is any.
			
		}
	}
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		return super.onCreateView(inflater, container, savedInstanceState);
	}
	
	@Override
	public void onAttach(Activity activity) {
		// TODO Auto-generated method stub
		super.onAttach(activity);
		
		try {
			mOnAgendaSelectedListener = (OnAgendaSelectedListener) activity;
		} catch (ClassCastException e) {
			throw new ClassCastException(activity.toString() + " needs to implement interface: OnAgendaSelectedListener");
		}
		
		
	}
}
